import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

import { asyncRoutes, constantRoutes } from './modules';

import { applyPermissionGuard } from './permission';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/project',
  },
  ...constantRoutes,
  ...asyncRoutes,
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;

applyPermissionGuard();
